using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
    /// <summary> 
    ///Author: daiduong19051986@gmail.com 
    /// <summary>

    public class TVC_MVPInfo
    {
        #region Local Variable
        public enum Field
        {
            Code,
            Lookup,
            Mark,
            Description,
            From_,
            To_,
            ItemCode,
            Status,
            Amount,
            POSOContract,
            Supplier,
            WellCode,
            Department,
            Location,
            Account,
            Description1,
            Purpose,
            Frequency,
            Reference,
            DeliveryPoint,
            ReceivedIssued,
            Template,
            Prefix,
            Suppend,
            headShipDate,
            headShipBy,
            headBL,
            headPI,
            headFrom,
            headTo,
            headPO,
            headSupplier,
            lblSupplier,
            headDepartment,
            headWell,
            headDelivery,
            Budget,
            BudgetAccount,
            HeadBudget,
            HeadBudgetAccount
        }
        private String _Code;
        private String _Lookup;
        private String _Mark;
        private String _Description;
        private String _From_;
        private String _To_;
        private String _ItemCode;
        private String _Status;
        private Double _Amount;
        private String _POSOContract;
        private String _Supplier;
        private String _WellCode;
        private String _Department;
        private String _Location;
        private String _Account;
        private String _Description1;
        private String _Purpose;
        private String _Frequency;
        private String _Reference;
        private String _DeliveryPoint;
        private String _ReceivedIssued;
        private String _Template;
        private String _Prefix;
        private Int32 _Suppend;
        private String _headShipDate;
        private String _headShipBy;
        private String _headBL;
        private String _headPI;
        private String _headFrom;
        private String _headTo;
        private String _headPO;
        private String _headSupplier;
        private String _lblSupplier;
        private String _headDepartment;
        private String _headWell;
        private String _headDelivery;
        string _Budget;
        string _BudgetAccount;
        string _HeadBudget;
        string _HeadBudgetAccount;

        public String Code { get { return _Code; } set { _Code = value; } }
        public String Lookup { get { return _Lookup; } set { _Lookup = value; } }
        public String Mark { get { return _Mark; } set { _Mark = value; } }
        public String Description { get { return _Description; } set { _Description = value; } }
        public String From_ { get { return _From_; } set { _From_ = value; } }
        public String To_ { get { return _To_; } set { _To_ = value; } }
        public String ItemCode { get { return _ItemCode; } set { _ItemCode = value; } }
        public String Status { get { return _Status; } set { _Status = value; } }
        public Double Amount { get { return _Amount; } set { _Amount = value; } }
        public String POSOContract { get { return _POSOContract; } set { _POSOContract = value; } }
        public String Supplier { get { return _Supplier; } set { _Supplier = value; } }
        public String WellCode { get { return _WellCode; } set { _WellCode = value; } }
        public String Department { get { return _Department; } set { _Department = value; } }
        public String Location { get { return _Location; } set { _Location = value; } }
        public String Account { get { return _Account; } set { _Account = value; } }
        public String Description1 { get { return _Description1; } set { _Description1 = value; } }
        public String Purpose { get { return _Purpose; } set { _Purpose = value; } }
        public String Frequency { get { return _Frequency; } set { _Frequency = value; } }
        public String Reference { get { return _Reference; } set { _Reference = value; } }
        public String DeliveryPoint { get { return _DeliveryPoint; } set { _DeliveryPoint = value; } }
        public String ReceivedIssued { get { return _ReceivedIssued; } set { _ReceivedIssued = value; } }
        public String Template { get { return _Template; } set { _Template = value; } }
        public String Prefix { get { return _Prefix; } set { _Prefix = value; } }
        public Int32 Suppend { get { return _Suppend; } set { _Suppend = value; } }
        public String headShipDate { get { return _headShipDate; } set { _headShipDate = value; } }
        public String headShipBy { get { return _headShipBy; } set { _headShipBy = value; } }
        public String headBL { get { return _headBL; } set { _headBL = value; } }
        public String headPI { get { return _headPI; } set { _headPI = value; } }
        public String headFrom { get { return _headFrom; } set { _headFrom = value; } }
        public String headTo { get { return _headTo; } set { _headTo = value; } }
        public String headPO { get { return _headPO; } set { _headPO = value; } }
        public String headSupplier { get { return _headSupplier; } set { _headSupplier = value; } }
        public String lblSupplier { get { return _lblSupplier; } set { _lblSupplier = value; } }
        public String headDepartment { get { return _headDepartment; } set { _headDepartment = value; } }
        public String headWell { get { return _headWell; } set { _headWell = value; } }
        public String headDelivery { get { return _headDelivery; } set { _headDelivery = value; } }
        public String Budget { get { return _Budget; } set { _Budget = value; } }
        public String BudgetAccount { get { return _BudgetAccount; } set { _BudgetAccount = value; } }
        public String HeadBudget { get { return _HeadBudget; } set { _HeadBudget = value; } }
        public String HeadBudgetAccount { get { return _HeadBudgetAccount; } set { _HeadBudgetAccount = value; } }

        #endregion LocalVariable

        #region Constructor
        public TVC_MVPInfo()
        {
            _Code = "";
            _Lookup = "";
            _Mark = "";
            _Description = "";
            _From_ = "";
            _To_ = "";
            _ItemCode = "";
            _Status = "";
            _Amount = 0;
            _POSOContract = "";
            _Supplier = "";
            _WellCode = "";
            _Department = "";
            _Location = "";
            _Account = "";
            _Description1 = "";
            _Purpose = "";
            _Frequency = "";
            _Reference = "";
            _DeliveryPoint = "";
            _ReceivedIssued = "";
            _Template = "";
            _Prefix = "";
            _Suppend = 0;
            _headShipDate = "";
            _headShipBy = "";
            _headBL = "";
            _headPI = "";
            _headFrom = "";
            _headTo = "";
            _headPO = "";
            _headSupplier = "";
            _lblSupplier = "";
            _headDepartment = "";
            _headWell = "";
            _headDelivery = "";
            _Budget = "";
            _BudgetAccount = "";
            _HeadBudget = "";
            _HeadBudgetAccount = "";
        }

        public TVC_MVPInfo(DataRow dr)
        {
            if (dr != null)
            {
                _Code = dr[Field.Code.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Code.ToString()]);
                _Lookup = dr[Field.Lookup.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Lookup.ToString()]);
                _Mark = dr[Field.Mark.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Mark.ToString()]);
                _Description = dr[Field.Description.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Description.ToString()]);
                _From_ = dr[Field.From_.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.From_.ToString()]);
                _To_ = dr[Field.To_.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.To_.ToString()]);
                _ItemCode = dr[Field.ItemCode.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.ItemCode.ToString()]);
                _Status = dr[Field.Status.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Status.ToString()]);
                _Amount = dr[Field.Amount.ToString()] == DBNull.Value ? 0 : Convert.ToDouble(dr[Field.Amount.ToString()]);
                _POSOContract = dr[Field.POSOContract.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.POSOContract.ToString()]);
                _Supplier = dr[Field.Supplier.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Supplier.ToString()]);
                _WellCode = dr[Field.WellCode.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.WellCode.ToString()]);
                _Department = dr[Field.Department.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Department.ToString()]);
                _Location = dr[Field.Location.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Location.ToString()]);
                _Account = dr[Field.Account.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Account.ToString()]);
                _Description1 = dr[Field.Description1.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Description1.ToString()]);
                _Purpose = dr[Field.Purpose.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Purpose.ToString()]);
                _Frequency = dr[Field.Frequency.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Frequency.ToString()]);
                _Reference = dr[Field.Reference.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Reference.ToString()]);
                _DeliveryPoint = dr[Field.DeliveryPoint.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.DeliveryPoint.ToString()]);
                _ReceivedIssued = dr[Field.ReceivedIssued.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.ReceivedIssued.ToString()]);
                _Template = dr[Field.Template.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Template.ToString()]);
                _Prefix = dr[Field.Prefix.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Prefix.ToString()]);
                _Suppend = dr[Field.Suppend.ToString()] == DBNull.Value ? 0 : Convert.ToInt32(dr[Field.Suppend.ToString()]);
                _headShipDate = dr[Field.headShipDate.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.headShipDate.ToString()]);
                _headShipBy = dr[Field.headShipBy.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.headShipBy.ToString()]);
                _headBL = dr[Field.headBL.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.headBL.ToString()]);
                _headPI = dr[Field.headPI.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.headPI.ToString()]);
                _headFrom = dr[Field.headFrom.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.headFrom.ToString()]);
                _headTo = dr[Field.headTo.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.headTo.ToString()]);
                _headPO = dr[Field.headPO.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.headPO.ToString()]);
                _headSupplier = dr[Field.headSupplier.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.headSupplier.ToString()]);
                _lblSupplier = dr[Field.lblSupplier.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.lblSupplier.ToString()]);
                _headDepartment = dr[Field.headDepartment.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.headDepartment.ToString()]);
                _headWell = dr[Field.headWell.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.headWell.ToString()]);
                _headDelivery = dr[Field.headDelivery.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.headDelivery.ToString()]);
                _Budget = dr[Field.Budget.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.Budget.ToString()]);
                _BudgetAccount = dr[Field.BudgetAccount.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.BudgetAccount.ToString()]);
                _HeadBudget = dr[Field.HeadBudget.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.HeadBudget.ToString()]);
                _HeadBudgetAccount = dr[Field.HeadBudgetAccount.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.HeadBudgetAccount.ToString()]);
            }
        }
        public TVC_MVPInfo(DataRowView dr)
            : this(dr.Row) { }
        public TVC_MVPInfo(TVC_MVPInfo objEntr)
        {
            _Code = objEntr.Code;
            _Lookup = objEntr.Lookup;
            _Mark = objEntr.Mark;
            _Description = objEntr.Description;
            _From_ = objEntr.From_;
            _To_ = objEntr.To_;
            _ItemCode = objEntr.ItemCode;
            _Status = objEntr.Status;
            _Amount = objEntr.Amount;
            _POSOContract = objEntr.POSOContract;
            _Supplier = objEntr.Supplier;
            _WellCode = objEntr.WellCode;
            _Department = objEntr.Department;
            _Location = objEntr.Location;
            _Account = objEntr.Account;
            _Description1 = objEntr.Description1;
            _Purpose = objEntr.Purpose;
            _Frequency = objEntr.Frequency;
            _Reference = objEntr.Reference;
            _DeliveryPoint = objEntr.DeliveryPoint;
            _ReceivedIssued = objEntr.ReceivedIssued;
            _Template = objEntr.Template;
            _Prefix = objEntr.Prefix;
            _Suppend = objEntr.Suppend;
            _headShipDate = objEntr.headShipDate;
            _headShipBy = objEntr.headShipBy;
            _headBL = objEntr.headBL;
            _headPI = objEntr.headPI;
            _headFrom = objEntr.headFrom;
            _headTo = objEntr.headTo;
            _headPO = objEntr.headPO;
            _headSupplier = objEntr.headSupplier;
            _lblSupplier = objEntr.lblSupplier;
            _headDepartment = objEntr.headDepartment;
            _headWell = objEntr.headWell;
            _headDelivery = objEntr.headDelivery;

            _Budget = objEntr.Budget;
            _BudgetAccount = objEntr.BudgetAccount;
            _HeadBudget = objEntr.HeadBudget;
            _HeadBudgetAccount = objEntr.HeadBudgetAccount;

        }
        #endregion Constructor

        #region InitTable
        public static DataTable ToDataTable()
        {
            DataTable dt = new DataTable("TVC_MVPHVJ");
            dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.Code.ToString(), typeof(String)),
				new DataColumn(Field.Lookup.ToString(), typeof(String)),
				new DataColumn(Field.Mark.ToString(), typeof(String)),
				new DataColumn(Field.Description.ToString(), typeof(String)),
				new DataColumn(Field.From_.ToString(), typeof(String)),
				new DataColumn(Field.To_.ToString(), typeof(String)),
				new DataColumn(Field.ItemCode.ToString(), typeof(String)),
				new DataColumn(Field.Status.ToString(), typeof(String)),
				new DataColumn(Field.Amount.ToString(), typeof(Double)),
				new DataColumn(Field.POSOContract.ToString(), typeof(String)),
				new DataColumn(Field.Supplier.ToString(), typeof(String)),
				new DataColumn(Field.WellCode.ToString(), typeof(String)),
				new DataColumn(Field.Department.ToString(), typeof(String)),
				new DataColumn(Field.Location.ToString(), typeof(String)),
				new DataColumn(Field.Account.ToString(), typeof(String)),
				new DataColumn(Field.Description1.ToString(), typeof(String)),
				new DataColumn(Field.Purpose.ToString(), typeof(String)),
				new DataColumn(Field.Frequency.ToString(), typeof(String)),
				new DataColumn(Field.Reference.ToString(), typeof(String)),
				new DataColumn(Field.DeliveryPoint.ToString(), typeof(String)),
				new DataColumn(Field.ReceivedIssued.ToString(), typeof(String)),
				new DataColumn(Field.Template.ToString(), typeof(String)),
				new DataColumn(Field.Prefix.ToString(), typeof(String)),
				new DataColumn(Field.Suppend.ToString(), typeof(Int32)),
				new DataColumn(Field.headShipDate.ToString(), typeof(String)),
				new DataColumn(Field.headShipBy.ToString(), typeof(String)),
				new DataColumn(Field.headBL.ToString(), typeof(String)),
				new DataColumn(Field.headPI.ToString(), typeof(String)),
				new DataColumn(Field.headFrom.ToString(), typeof(String)),
				new DataColumn(Field.headTo.ToString(), typeof(String)),
				new DataColumn(Field.headPO.ToString(), typeof(String)),
				new DataColumn(Field.headSupplier.ToString(), typeof(String)),
				new DataColumn(Field.lblSupplier.ToString(), typeof(String)),
				new DataColumn(Field.headDepartment.ToString(), typeof(String)),
				new DataColumn(Field.headWell.ToString(), typeof(String)),
				new DataColumn(Field.headDelivery.ToString(), typeof(String)),
				new DataColumn(Field.Budget.ToString(), typeof(String)),
				new DataColumn(Field.BudgetAccount.ToString(), typeof(String)),
				new DataColumn(Field.HeadBudget.ToString(), typeof(String)),
				new DataColumn(Field.HeadBudgetAccount.ToString(), typeof(String))
			});
            return dt;
        }
        public DataRow ToDataRow(DataTable dt)
        {
            DataRow row = dt.NewRow();
            row[Field.Code.ToString()] = _Code;
            row[Field.Lookup.ToString()] = _Lookup;
            row[Field.Mark.ToString()] = _Mark;
            row[Field.Description.ToString()] = _Description;
            row[Field.From_.ToString()] = _From_;
            row[Field.To_.ToString()] = _To_;
            row[Field.ItemCode.ToString()] = _ItemCode;
            row[Field.Status.ToString()] = _Status;
            row[Field.Amount.ToString()] = _Amount;
            row[Field.POSOContract.ToString()] = _POSOContract;
            row[Field.Supplier.ToString()] = _Supplier;
            row[Field.WellCode.ToString()] = _WellCode;
            row[Field.Department.ToString()] = _Department;
            row[Field.Location.ToString()] = _Location;
            row[Field.Account.ToString()] = _Account;
            row[Field.Description1.ToString()] = _Description1;
            row[Field.Purpose.ToString()] = _Purpose;
            row[Field.Frequency.ToString()] = _Frequency;
            row[Field.Reference.ToString()] = _Reference;
            row[Field.DeliveryPoint.ToString()] = _DeliveryPoint;
            row[Field.ReceivedIssued.ToString()] = _ReceivedIssued;
            row[Field.Template.ToString()] = _Template;
            row[Field.Prefix.ToString()] = _Prefix;
            row[Field.Suppend.ToString()] = _Suppend;
            row[Field.headShipDate.ToString()] = _headShipDate;
            row[Field.headShipBy.ToString()] = _headShipBy;
            row[Field.headBL.ToString()] = _headBL;
            row[Field.headPI.ToString()] = _headPI;
            row[Field.headFrom.ToString()] = _headFrom;
            row[Field.headTo.ToString()] = _headTo;
            row[Field.headPO.ToString()] = _headPO;
            row[Field.headSupplier.ToString()] = _headSupplier;
            row[Field.lblSupplier.ToString()] = _lblSupplier;
            row[Field.headDepartment.ToString()] = _headDepartment;
            row[Field.headWell.ToString()] = _headWell;
            row[Field.headDelivery.ToString()] = _headDelivery;

            row[Field.Budget.ToString()] = _Budget;
            row[Field.BudgetAccount.ToString()] = _BudgetAccount;
            row[Field.HeadBudget.ToString()] = _HeadBudget;
            row[Field.HeadBudgetAccount.ToString()] = _HeadBudgetAccount;
            return row;
        }
        #endregion InitTable
    }
}
